<html>
<head>
	<title>test</title>
	<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
</head>
<body> 
	<form method="post" action="">
请输入Base64值:<br><textarea type="text" name="fname"  rows="20"cols="60" >
</textarea> <br>
<input type="submit" name="button" value="编码">
<input type="submit" name="button" value="解码" />
</form>

<?php 
@$text = $_POST['fname']; 
@$button = $_POST['button'];
?>
<br>
输出：<br>
<textarea rows="20" cols="60">
<?php	if($button=="编码") echo base64_encode($text);
		if($button=="解码") echo base64_decode($text);  ?>
</textarea>
</body>
</html> 

    